I think - although i don't quite understand it - that by passing in Func<object>[] the values passed are not evaluated until they have to be, so for example if you have a load of Debug statements in your code - the parameters you are passing will only be evaluated if the logging level is set to debug ?
so for example LogHelper.Debug<sometype>("the nubmer of things", ()=> item.Children.Count() )
would not evaluate item.Children.Count() unless Debug is enabled in the config - meaning that the log lines are not detremental to performance when not needed.
That's why i think it does it. but I am sure some who actually understands it can shed more light on it.
Why do LogHelper methods take a "params Func<object>[] formatItems" arg?
..instead of
params object[] formatItems
The log4net adapter just converts the Func
I think - although i don't quite understand it - that by passing in Func<object>[] the values passed are not evaluated until they have to be, so for example if you have a load of Debug statements in your code - the parameters you are passing will only be evaluated if the logging level is set to debug ?
so for example LogHelper.Debug<sometype>("the nubmer of things", ()=> item.Children.Count() )
would not evaluate item.Children.Count() unless Debug is enabled in the config - meaning that the log lines are not detremental to performance when not needed.
That's why i think it does it. but I am sure some who actually understands it can shed more light on it.
is working on a reply...